home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / internet / tcp / amitcp / amitcp-src-22.lha / AmiTCP-2.2 / src / l / inet-handler / c.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-17  |  1.2 KB  |  69 lines

  1. /*
  2.  * c.c
  3.  *
  4.  * Author: Tomi Ollila <too@cs.hut.fi>
  5.  *
  6.  * Copyright (c) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
  7.  *               All rights reserved
  8.  *
  9.  * Created: Wed Sep 15 14:12:12 1993 too
  10.  * Last modified: Sat Oct 16 16:53:29 1993 too
  11.  *
  12.  * $Id: c.c,v 1.1 1993/10/24 12:50:39 too Exp $
  13.  *
  14.  * HISTORY
  15.  * $Log: c.c,v $
  16.  * Revision 1.1  1993/10/24  12:50:39  too
  17.  * Initial revision
  18.  *
  19.  * Revision 1.1  1993/10/24  12:50:39  too
  20.  * Initial revision
  21.  *
  22.  */
  23.  
  24. #include "c.h"
  25.  
  26. void bzero(char * mem, int len)
  27. {
  28.   char *i;
  29.   
  30.   for(i = mem; len > 0; i++, len--)
  31.     *i = '\0';
  32. }
  33.  
  34. #if 0
  35. #define isupper(x) ((x) >= 'A' && (x) <= 'Z')
  36. #define tolower(x) ((x) & 0x5F) /* this is only used w/ isupper() */
  37.  
  38. int strncasecmp(char * a, char * b, int n)
  39. {
  40.   char la; char lb;
  41.  
  42.   la = *a; if (isupper(la)) la = tolower(la);
  43.   lb = *b; if (isupper(la)) la = tolower(la);
  44.   
  45.   while (--n > 0) { /* don't check last one */
  46.     if ((la == '\0') || (la != lb))
  47.       break;
  48.     a++;
  49.     b++;
  50.     la = *a; if (isupper(la)) la = tolower(la);
  51.     lb = *b; if (isupper(la)) la = tolower(la);
  52.   }
  53.   return (lb - la);
  54. }
  55.  
  56. #endif
  57.  
  58. int atoi(char * a)
  59. {
  60.   int i = 0;
  61.  
  62.   while (isdigit(*a)) {
  63.     i *= 10;
  64.     i += *a - '0';
  65.     a++;
  66.   }
  67.   return i;
  68. }
  69.